Distribution Functions
rnorm(n), dnorm(x) pnorm(x) and qnorm(q) . Generate samples: rnorm(30), dnorm(1.65), pnorm(1.65) and qnorm(0.85) .
Consider the parameters required for the corresponding distribution.
An expression for a probability can look like one of the following: \(P(a < X < b)\), \(P(a \leq X \leq b)\), \(P(a \leq X < b)\), \(P(a < X)\), \(P(a \leq X)\), \(P(a > X)\), \(P(a \geq X)\), etc.
Remember the plotting function hist and curve.
hist and curve.Minimum and Maximum of Independent Random Variables
r<dist> to simulate.hist(Y1, prob = T, breaks = 40) # draw a histogram
# define a function of the pdf in Section 1.1
f1 <- function(y) {
1 / 40 * exp(-y / 40) + 1 / 50 * exp(-y / 50) - 9 / 200 * exp(-9 * y / 200)
}
# draw a curve based on the above function and add it to the histogram
curve(f1, from = 0, to = 350, add = T, col = "red")